package com.example.casper.jnuexperiment2025;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class Hello04839Activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hello04839);

        RecyclerView recyclerView = findViewById(R.id.recycler_view_my_books);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(new BookAdapter(getListBooks()));
    }

    // 生成图书列表的方法
    private List<Book> getListBooks() {
        List<Book> books = new ArrayList<>();
        books.add(new Book("无名之书", R.drawable.book_no_name));
        books.add(new Book("软件项目管理案例教程（第3版）", R.drawable.book_2));
        books.add(new Book("信息安全数学基础（第2版）", R.drawable.book_1));
        return books;
    }
}